import groovy.sql.Sql

/**
 * Created by g705353 on 10/30/2014.
 */


def sql = Sql.newInstance("jdbc:mysql://10.28.120.245:3306/mvno_dev", "mvno", "mvno", "com.mysql.jdbc.Driver")

// note: change period below when loading data
def mainQuery = "select date, city_id, mno_id, mvno_id, province_id, data_expense, sms_expense, voice_expense, mms_expense \n" +
        "from business_trend_monthly_report where year(date) = ? limit 5"
println "first query: ${mainQuery}\n"
sql.eachRow(mainQuery, [2014]) {
    println("${it.date}, ${it.city_id}, ${it.data_expense}")
}